
    <script type="text/javascript">
        tinyMCE.init({
        	// General options
        	mode : "textareas",
        	theme : "advanced",
        	plugins : "table,inlinepopups",

        	// Theme options
        	theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,|,table,removeformat,code",
        	theme_advanced_buttons2 : "",
        	theme_advanced_buttons3 : "",
        	theme_advanced_buttons4 : "",
        	theme_advanced_toolbar_location : "top",
        	theme_advanced_toolbar_align : "left",
        	theme_advanced_statusbar_location : "bottom",
        	theme_advanced_resizing : true,

        	// Example content CSS (should be your site CSS)
        	content_css : "/js/tinymce/examples/css/content.css",

        	// Style formats
        	style_formats : [
        		{title : 'Bold text', inline : 'b'},
        		{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
        		{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
        		{title : 'Example 1', inline : 'span', classes : 'example1'},
        		{title : 'Example 2', inline : 'span', classes : 'example2'},
        		{title : 'Table styles'},
        		{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
        	],

        	formats : {
        		alignleft : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'left'},
        		aligncenter : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'center'},
        		alignright : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'right'},
        		alignfull : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'full'},
        		bold : {inline : 'span', 'classes' : 'bold'},
        		italic : {inline : 'span', 'classes' : 'italic'},
        		underline : {inline : 'span', 'classes' : 'underline', exact : true},
        		strikethrough : {inline : 'del'},
        		customformat : {inline : 'span', styles : {color : '#00ff00', fontSize : '20px'}, attributes : {title : 'My custom format'}}
        	}
        });

        $().ready(function() {
            $("#ticketForm").validate({
                errorLabelContainer: $("#ticketForm div.error")
            });
        });
    </script>
    <!-- /TinyMCE -->

    <style type="text/css">
        .ticketForm fieldset p.error label { color: red; }
        form.ticketForm label.error {
            display: block;
            margin-left: 1em;
            width: auto;
        }
        div.error {
            background-color: #eee;
            border: 1px dashed red;
            margin: 5px;
            padding: 10px;
        }
    </style>

<form id="ticketForm" name="ticketForm" action="<?php echo $html->url('/ticket/opencreate'); ?>" method="post" enctype="multipart/form-data">

    <?php
     if ($view == 'review') {
     ?>
    <table width="100%" border="0" cellpadding="20">

        <tr>
            <td colspan="2">Ticket Summary</td>
        </tr>

        <tr>
            <td id="input_label">&nbsp;Your Name</td>
            <td id="input_box">
                <?php echo $summary['create']['your_name']; ?>
                <input type="hidden" name="data[create][your_name]" value="<?php echo $summary['create']['your_name']; ?>" />
            </td>
        </tr>

        <tr>
            <td id="input_label">&nbsp;Email Address</td>
            <td id="input_box">
                <?php echo $summary['create']['email_address']; ?>
                <input type="hidden" name="data[create][email_address]" value="<?php echo $summary['create']['email_address']; ?>" />
            </td>
        </tr>

        <tr>
            <td id="input_label">&nbsp;Department</td>
            <td id="input_box">
                <?php echo $summary['create']['department_value']['Extra']['value']; ?>
                <input type="hidden" name="data[create][department]" value="<?php echo $summary['create']['department']; ?>" />
            </td>
        </tr>

        <tr>
            <td id="input_label">&nbsp;Priority</td>
            <td id="input_box">
                <?php echo $summary['create']['priority_value']['Extra']['value']; ?>
                <input type="hidden" name="data[create][priority]" value="<?php echo $summary['create']['priority']; ?>" />
            </td>
        </tr>

        <tr>
            <td id="input_label">&nbsp;Subject</td>
            <td id="input_box">
                <?php echo $summary['create']['subject']; ?>
                <input type="hidden" name="data[create][subject]" value="<?php echo $summary['create']['subject']; ?>" />
            </td>
        </tr>

        <tr>
            <td id="input_label">&nbsp;Details</td>
            <td id="input_box">
                <?php echo $summary['create']['summary']; ?>
                <input type="hidden" name="data[create][summary]" value="<?php echo $summary['create']['summary']; ?>" />
            </td>
        </tr>

        <tr>
            <td id="spacer" colspan="2">&nbsp;</td>
        </tr>
        <tr>
            <td id="spacer" colspan="2">&nbsp;</td>
        </tr>

        <tr>
            <td>&nbsp;</td>
            <td>
                <input type="submit" name="data[create][button]" value="Back" style="width: 100px; height: 30px;" />
                <input type="submit" name="data[create][button]" value="Confirm" style="width: 100px; height: 30px;" />
            </td>
        </tr>

    </table>
    <?php
     } else {
     ?>
    <table width="100%" border="0" cellpadding="20">

        <tr>
            <td colspan="2"><div class="error"></div></td>
        </tr>

        <tr>
            <td id="input_label"><font color="red"><b>*</b></font>&nbsp;Your Name</td>
            <td id="input_box">
                <input type="text" name="data[create][your_name]" id="your_name" style="width: 400px" value="<?php echo $details['create']['your_name']; ?>" title="Please indicate your fullname<br/>" class="{required:true}" />
            </td>
        </tr>
        <tr>
            <td id="input_label"><font color="red"><b>*</b></font>&nbsp;Email Address</td>
            <td id="input_box">
                <input type="text" name="data[create][email_address]" id="email" style="width: 400px" value="<?php echo $details['create']['email_address']; ?>" title="Please indicate your email address<br/>" class="{required:true}" />
            </td>
        </tr>

        <tr>
            <td id="spacer" colspan="2">&nbsp;</td>
        </tr>

        <tr>
            <td colspan="2">
                <h4>Ticket Details</h4>
            </td>
        </tr>
        <tr>
            <td id="input_label">&nbsp;Priority</td>
            <td id="input_box">
                <?php echo $form->select('create.priority', $priorities, $details['create']['priority'], array('id' => 'department', 'style' => 'width: 250px;')); ?>
            </td>
        </tr>
        <tr>
            <td id="input_label">&nbsp;Department</td>
            <td id="input_box">
                <?php echo $form->select('create.department', $departments, $details['create']['department'], array('id' => 'department', 'style' => 'width: 250px;')); ?>
            </td>
        </tr>
        <tr>
            <td id="input_label"><font color="red"><b>*</b></font>&nbsp;Subject</td>
            <td id="input_box">
                <input type="text" name="data[create][subject]" id="subject" style="width: 400px" value="<?php echo $details['create']['subject']; ?>" title="Provide a subject of the ticket<br/>" class="{required:true}" />
            </td>
        </tr>
        <tr>
            <td id="input_label" colspan="2"><font color="red"><b>*</b></font>&nbsp;Details</td>
        </tr>
        <tr>
            <td colspan="2">
                <textarea id="summary" name="data[create][summary]" style="width: 100%;" title="" class=""><?php echo $details['create']['summary']; ?></textarea>
            </td>
        </tr>

        <tr>
            <td id="spacer" colspan="2">&nbsp;</td>
        </tr>
        <tr>
            <td id="spacer" colspan="2">&nbsp;</td>
        </tr>

        <tr>
            <td>&nbsp;</td>
            <td>
                <input type="submit" name="data[create][button]" value="Send" style="width: 100px; height: 30px;" />

            </td>
        </tr>

    </table>
    <?php
     }
     ?>

</form>

<script type="text/javascript">
<!--
function checkmsg()
{
    var msg = '<?php echo $msg; ?>';
    if (msg) alert(msg);
}

function setdropdowndefault()
{
    //document.getElementById('log_type').selectedIndex = 0;
    //document.getElementById('category').selectedIndex = 0;
    //document.getElementById('item').selectedIndex = 0;
    document.getElementById('department').selectedIndex = 0;
    //document.getElementById('infrastructure').selectedIndex = 0;
}

checkmsg();
setdropdowndefault();
//-->
</script>